package kliment.data
{
	public class XMLEncrypt
	{

		public function decode(value:String):XML
		{
			var newValue:String = "";
			if (value.charAt(0) != '<') {
				var ecPos:int = value.indexOf(" ")+1;
				var eC:String = value.charAt(ecPos);
				value = value.substr(ecPos+1);

				var iL = value.length;
				for (var n:uint = 0; n < iL; n++)
				{
					if (value.charAt(n) == eC)
					{
						var p:Number = value.charCodeAt(n+1)*114 + value.charCodeAt(n+2) - 1610;
						var l:Number = value.charCodeAt(n+3)-14;
						newValue += newValue.substr(-p, l);
						n += 3;
					}
					else
					{
						newValue += value.charAt(n);
					}
				}
				return new XML(newValue);
			}

			return new XML(value);
		}

		public function encode(value:XML):String
		{
			return "";
		}
	}
}